The suspend
function modifier is used to mark a function which might take some time to execute and could suspend the caller coroutine.
The location where such function is called is a "suspension point". Functions marked as suspend
("suspending functions") should
themselves contain at least one suspension point, otherwise it makes no sense to mark it as suspend
This rule reports an issue if a function with suspend
modifier has no calls to other suspend
functions inside its
body.
Noncompliant code example
suspend fun function() { // Noncompliant, redundant 'suspend' modifier
println("Hello!")
}
Compliant solution
fun function() {
println("Hello!")
}